package gson.emlog.activity;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import gson.emlog.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.Toast;

/**
 * 碎语回复
 * 
 * @author GodSon
 * 
 */
public class TwitterReply extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.twitterreply);
		ListView replyView = (ListView) findViewById(R.id.tw_reply_view);

		List<HashMap<String, Object>> items = new ArrayList<HashMap<String, Object>>();

		HashMap<String, Object> item = new HashMap<String, Object>();
		item.put("id", "1");
		item.put("pepole", "____′↘夏悸");
		item.put("twdate", "1分钟前");
		item.put("twct", "好操蛋的系统架构设计");
		items.add(item);

		HashMap<String, Object> item2 = new HashMap<String, Object>();
		item2.put("id", "2");
		item2.put("pepole", "____′↘夏悸");
		item2.put("twdate", "1分钟前");
		item2.put("twct", "好操蛋的系统架构设计");
		items.add(item2);
		
		SimpleAdapter sadpt = new SimpleAdapter(this, items, R.layout.twreplyitem, new String[]{"pepole","twdate","twct"}, new int[]{R.id.tw_Reply_pepole,R.id.tw_Reply_date,R.id.tw_Reply_ct});
		
		replyView.setAdapter(sadpt);
		
		replyView.setOnItemLongClickListener(new OnItemLongClickListener() {
			@SuppressWarnings("unchecked")
			public boolean onItemLongClick(AdapterView<?> adptv, View v,
					int position, long id) {
				HashMap<String, Object> item = (HashMap<String, Object>) adptv.getAdapter().getItem(position);
				Toast.makeText(TwitterReply.this, item.get("id").toString(), Toast.LENGTH_SHORT).show();
				return false;
			}
		});
	}
}
